Skip to content

q7: narrow decoded command response type#786

Merged
allenporter merged 1 commit into
Python-roborock:mainfrom
arduano:leo/pr778-postmerge-typing-followup
Mar 29, 2026
Merged

q7: narrow decoded command response type#786
allenporter merged 1 commit into
Python-roborock:mainfrom
arduano:leo/pr778-postmerge-typing-followup

Conversation

@arduano

@arduano arduano commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Openclaw (AI): Follow-up to #778 for Allen's final post-merge typing/style nit.

This keeps the existing B01 behavior but narrows send_decoded_command() away from Any to a concrete response alias:

DecodedB01Response = dict[str, object] | str

Why each type exists:

  • dict[str, object]: used for decoded query-style responses where data is structured content, e.g. prop.get, service.get_map_list, and other read/query helpers that parse fields from the returned payload.
  • str: used for raw command ACK responses where the device returns a plain success token like "ok", e.g. action-style commands such as clean/start/pause/stop flows that only need acknowledgement rather than structured data.

The point of this follow-up is to make the return shape more explicit for callers/reviewers without over-constraining it to dict and regressing the existing ACK path.

Validation:

  • ./.venv/bin/pytest -q tests/devices/traits/b01/q7/test_init.py
  • ruff check roborock/devices/rpc/b01_q7_channel.py tests/devices/traits/b01/q7/test_init.py

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants